﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using Kingdee.BOS;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Util;
using Kingdee.BOS.Core;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Metadata.ControlElement;
using Kingdee.BOS.Core.Metadata.FieldElement;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.CommonFilter;
using Kingdee.BOS.Core.CommonFilter.PlugIn;
using Kingdee.BOS.Core.CommonFilter.PlugIn.Args;

namespace KMXM_ReportPlugin
{
    //[Kingdee.BOS.Util.HotUpdate]
    public class KMXMFilterEdit : AbstractCommonFilterPlugIn 
    {
        /// <summary>
        /// 当前单据元数据
        /// </summary>
        //private BusinessInfo _currBusinessInfo;
        ///// <summary>
        ///// 当前单据外观
        ///// </summary>
        //private LayoutInfo _currLayoutInfo;
        /// <summary>
        /// 调整单据的逻辑元数据包，动态添加新字段的元数据
        /// </summary>
        /// <param name="e"></param>
        public override void AfterBindData(EventArgs e)
        {
            base.AfterBindData(e);
        }
        //public override void OnSetBusinessInfo(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.SetBusinessInfoArgs e)
        //{
        //    FormMetadata currmetadata = (FormMetadata)ObjectUtils.CreateCopy(
        //    this.View.OpenParameter.FormMetaData);
        //    _currBusinessInfo = currmetadata.BusinessInfo;
        //    _currLayoutInfo = currmetadata.GetLayoutInfo();
        //    e.BusinessInfo = _currBusinessInfo;
        //    base.OnSetBusinessInfo(e);
        //}
        //public override void OnSetLayoutInfo(SetLayoutInfoArgs e)
        //{
        //    string FKEY, FFieldName;

        //    FieldShowHideAppearance columns = _currLayoutInfo.GetAppearance(CommonFilterConst.ControlKey_FieldShowHide) as FieldShowHideAppearance;
        //    if (columns != null)
        //    {
        //        StringBuilder sql = new StringBuilder();

        //        sql.Append("exec SP_ZYKMBILL_BT");


        //        var dr = DBUtils.ExecuteReader(this.Context, sql.ToString());
        //        while (dr.Read())
        //        {
        //            sql.Clear();
        //            FKEY = dr["FKEY"].ToString();
        //            FFieldName = dr["FFieldName"].ToString();

        //            Field newField = new Field(FKEY);
        //            newField.Name = new LocaleValue(FFieldName);
        //            newField.FieldName = FKEY;
        //            newField.EntityKey = "";
        //            columns.FieldList.Add(newField);

        //        }

        //    }
        //    e.LayoutInfo = _currLayoutInfo;
        //}

    }
}
